'use strict';

module.exports = {
  /**
   *
   * @param {string} message 成功提示消息
   * @param {Array} data 返回数据
   */
  success(message = 'success', data = null) {
    this.status = 200;
    this.body = {
      code: 0,
      message,
      data,
    };
  },


  /**
 *
 * @param {string} message 错误提示消息
 * @param {number} status 服务器状态码
 * @param {Array} data 数据
 * @param {number} code code码

 */
  error(message = 'error', status = 500, data = null, code = 1) {
    this.ctx.status = status;
    this.ctx.body = {
      code,
      message,
      data,
    };
  },
};
